class ChordText 

  # Attributes
  attr_reader :mfc_class_name
  attr_reader :mfc_class_schema

  attr_reader :position
  attr_accessor :chord_name

  # Constants   
  DEFAULT_POSITION = 0
  
  # Constructor  
  def initialize(position = DEFAULT_POSITION, chord_name = nil)
    mfc_class_name = "CChordText"
    mfc_class_schema = 1

    @chord_name = ChordName.new unless chord_name

    return false unless valid_position?(position)
    return true
  end
  
  # Methods 
  def valid_position?(position) 
    return ((position >= 0) && (position <= 255))
  end
      
  def position=(position) 
    return false unless valid_position?(position)
    @position = position
    return true
  end
         
  # Serialization
  def do_serialize(stream)   
    write_byte(stream, @position)    
    @chord_name.do_serialize(stream)
    return true
  end
   
  def do_deserialize(stream)
    @position = read_byte(stream)
    @chord_name = ChordName.new
    @chord_name.do_deserialize(stream)
  end
   
end
